<template>
	<view class="line-item-wrapper box relative" @click="toDetail">
		<view class="line-item-header">
			<image :src="record.avatar" class="user-avatar"></image>
			<view class="user-name">
				<text>{{ record.username }}</text>
			</view>
			<view class="item-tag">
				<text>独享</text>
			</view>
		</view>
		<view class="line-item-content">
			<view class="item-left-image">
				<image :src="record.image" mode="aspectFill" class="line-image"></image>
			</view>
			<view class="item-right-desc">
				<view class="right-item-title">
					<text>{{ record.name }}</text>
				</view>
				<view class="item-desc-item">
					<image class="desc-icon" mode="aspectFill" src="../static/icon/location.png"></image>
					<text class="desc-value">{{ record.start }}-{{ record.end }}</text>
				</view>
				<view class="item-desc-item">
					<image class="desc-icon" mode="aspectFill" src="../static/icon/time.png"></image>
					<text class="desc-value">{{ record.day }}天</text>
				</view>
				<view class="item-desc-item">
					<image class="desc-icon" mode="aspectFill" src="../static/icon/location.png"></image>
					<text class="desc-value">{{ record.car }}</text>
				</view>
				<!-- <view class="buy-user-list">
					<avatar-list :list="avatarList" />
					<text class="buy-user-text">3人已上车</text>
				</view> -->
			</view>
		</view>
	</view>
</template>

<script>
	// import AvatarList from './avatar-list.vue'
	export default {
		methods: {
			toDetail() {
				uni.navigateTo({
					url: '/pages-bundle/line-detail/line-detail?id=' + this.record.id
				})
			},
		},
		// components: { AvatarList },
		props: ['record'],
		data() {
			return {
				// avatarList: ['../static/avatar.gif', '../static/avatar.gif', '../static/avatar.gif']
			}
		}
	}
</script>

<style lang="scss" scoped>
	.line-item-wrapper {
		padding: 24rpx;
		background: #FFFFFF;
		border-radius: 16rpx;
		overflow: hidden;
		box-sizing: border-box;

		.line-item-content {
			display: flex;
			flex-flow: row nowrap;
			margin-top: 16rpx;

			.item-right-desc {
				flex: 1;

				.buy-user-list {
					display: flex;
					align-items: center;
					margin-top: 16rpx;

					.buy-user-text {
						height: 32rpx;
						font-size: 20rpx;
						color: rgba(0, 0, 0, 0.9);
						line-height: 32rpx;
						margin-left: 8rpx;
					}
				}

				.item-desc-item {
					display: flex;
					align-items: center;
					margin-bottom: 8rpx;

					&:last-child {
						margin-bottom: 0;
					}

					.desc-icon {
						width: 24rpx;
						height: 24rpx;
					}

					.desc-value {
						margin-left: 8rpx;
						height: 32rpx;
						font-size: 20rpx;
						color: rgba(0, 0, 0, 0.6);
						line-height: 32rpx;
					}
				}

				.right-item-title {
					font-size: 26rpx;
					color: rgba(0, 0, 0, 0.9);
					line-height: 40rpx;
					word-break: break-all;
					font-weight: bold;
					margin-bottom: 24rpx;
				}
			}

			.item-left-image {
				width: 310rpx;
				height: 248rpx;
				border-radius: 16rpx;
				overflow: hidden;
				margin-right: 20rpx;
				box-sizing: border-box;
				position: relative;

				.line-image {
					width: 100%;
					height: 100%;
				}
			}
		}

		.line-item-header {
			display: flex;
			align-items: center;
			justify-content: flex-start;

			.item-tag {
				margin-left: 16rpx;
				background: linear-gradient(135deg, #8BDCFF 0%, #E4FF68 100%);
				border-radius: 4rpx 4rpx 4rpx 4rpx;
				padding: 6rpx 16rpx;
				overflow: hidden;
				display: flex;
				justify-content: center;
				align-items: center;
				font-size: 16rpx;
				color: rgba(0, 0, 0, 0.9);
			}

			.user-name {
				height: 40rpx;
				font-size: 24rpx;
				color: rgba(0, 0, 0, 0.9);
				line-height: 40rpx;
				margin-left: 16rpx;
			}

			.user-avatar {
				width: 50rpx;
				height: 50rpx;
				overflow: hidden;
				border-radius: 50%;
			}
		}
	}
</style>